﻿namespace DeltaGroup.WheelOfJeopardy.UI.ViewModel
{
    using System.ComponentModel;

    using DeltaGroup.WheelOfJeopardy.Model;

    public class ChallengePromptViewModel : BaseViewModel, IDataErrorInfo
    {
        #region Fields

        private int _timeRemaining;

        #endregion Fields

        #region Properties

        /// <summary>
        /// Gets or sets the challenge.
        /// </summary>
        /// <value>The challenge.</value>
        public Challenge Challenge
        {
            get; set;
        }

        /// <summary>
        /// Gets an error message indicating what is wrong with this object.
        /// </summary>
        /// <value></value>
        /// <returns>An error message indicating what is wrong with this object. The default is an empty string ("").</returns>
        public string Error
        {
            get { return null; }
        }

        /// <summary>
        /// Gets or sets the response.
        /// </summary>
        /// <value>The response.</value>
        public string Response
        {
            get; set;
        }

        /// <summary>
        /// Gets or sets the time remaining.
        /// </summary>
        /// <value>The time remaining.</value>
        public int TimeRemaining
        {
            get { return _timeRemaining; }
            set
            {
                _timeRemaining = value;
                FirePropertyChanged("TimeRemaining");
            }
        }

        #endregion Properties

        #region Indexers

        /// <summary>
        /// Gets the <see cref="System.String"/> with the specified column name.
        /// </summary>
        /// <value></value>
        public string this[string columnName]
        {
            get
            {
                if(columnName == "Response")
                    if (string.IsNullOrWhiteSpace(Response))
                        return "Please enter a response to this challenge";
                return null;
            }
        }

        #endregion Indexers
    }
}